<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Model\Config;
use Illuminate\Http\Request;

class ConfigController extends Controller
{
    public function __construct()
    {
        $this->middleware('admin:Admin_config');
    }
    //模块儿配置项控制器
    //配置各个模块儿相关的相关设置
    public function edit($name)
    {
        return view('admin.config.' . $name);
    }


    public function update(Request $request, $name)
    {
        $config = get_config('admin', []);
        $config[$name] = $request->except(['_token', '_method']);
        save_config($config);
        return back()->with('success', '配置项设置成功');
    }

}
